package github.flandre.examplemod.core.init.event;

import github.flandre.examplemod.common.entity.render.ExampleEntityRender;
import github.flandre.examplemod.core.init.EntityInit;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

//渲染实体

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)//仅在客户端中体现
public class ClientEvent {
    @SubscribeEvent
    public static void propertyOverrideRegistry(FMLClientSetupEvent event){
        event.enqueueWork(
                ()->{
                    Minecraft mc = Minecraft.getInstance();
                    //获取渲染管理器
                    EntityRendererManager manager = mc.getRenderManager();
                    manager.register(
                            EntityInit.EXAMPLE_ENTITY.get(),
                            new ExampleEntityRender(manager)
                    );
                }
        );
    }

}

//实体的注册
